package com.easybuilder.core.seo.service.impl;


import com.easybuilder.common.utils.SpringUtil;
import com.easybuilder.core.seo.service.AbstractSeoService;
import com.easybuilder.core.seo.service.SeoService;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class SeoServiceImpl implements SeoService, InitializingBean {

    // 推送服务集合
    private static List<AbstractSeoService> seoServiceList = new ArrayList<>();


    /** 推送 */
    @Override
    public void push(String url) {
        seoServiceList.forEach(service -> {
            service.push(url);
        });
    }


    @Override
    public void afterPropertiesSet() throws Exception {
        // 初始化推送服务实例
        seoServiceList.add(SpringUtil.getBean(BaiduSeoService.class));
        seoServiceList.add(SpringUtil.getBean(GoogleSeoService.class));
        seoServiceList.add(SpringUtil.getBean(Three60SeoService.class));
    }
}
